#ifndef IMAGE_LIST_BOX_H
#define IMAGE_LIST_BOX_H

#include <QtGui>
class FlowLayout;

class ImageIcon : public QAbstractButton {
Q_OBJECT
public:
    ImageIcon(QWidget *parent);
    void setPixmap(const QPixmap &pix);
    QSize sizeHint() const;
    QVariant getId() const {return id;}
    void setId(QVariant v) {id = v;}
    void setImageEnabled(bool on);
    bool isImageEnabled() {return imageEnabled;}
protected:
    bool imageEnabled;
    QVariant id;
    QPixmap pix;
    QSize margin;
    void paintEvent(QPaintEvent *event);
protected slots:
    void clickedSlot();
signals:
    void clicked(QVariant id);
};

class ImageListBox : public QScrollArea {
Q_OBJECT
public:
    ImageListBox(QWidget *parent);
    void addIcon(ImageIcon *icon);
    ImageIcon *getImageIcon();
    ImageIcon *getSelected() {return selected;}
protected:
    QList < ImageIcon * > widgets;
    FlowLayout *layout;
    QWidget *widget;
    ImageIcon *selected;
protected slots:
    void iconClicked(QVariant id);
signals:
    void clicked(QVariant id);
};

#endif

